<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>认识URL</title>
</head>

<body>
  <!-- 
    新闻数据地址: http://hmajax.itheima.net/api/news
  -->
  <button class='btn'>获取新闻数据</button>
  <script src="https://unpkg.com/axios@0.21.1/dist/axios.min.js"></script>
  <script>
    document.querySelector('.btn').addEventListener('click', () => {
      axios({
        url: ' http://hmajax.itheima.net/api/news'
      }).then(result => {
        console.log(result.data.data)  //获取到新闻内容
      })
    })

  </script>
</body>

</html>